﻿@model CSCSN.WebApplication.Models.UserDataVM

@{
    ViewData["Title"] = "Updata";
    Layout = "_LayoutNavigationBar";
}
<style>
    .date {
        margin-left: 70px;
    }
</style>
<div class="right_content_title">
    <span class="right_content_title_text">信息修改</span>
</div>

<div class="right_content_Form">
    <div class="From_content">
        <form asp-action="Update">
            @Html.HiddenFor(Model => Model.Id)
            <div asp-validation-summary="ModelOnly" class="text-danger"></div>
            <div class="form-group">
                <label asp-for="UserName" class="control">账号: @ViewData["UserName"]</label>
            </div>
            <div class="form-group">
                <label asp-for="Name" class="control-label">昵称:</label>
                <input asp-for="Name" class="form-control" value="@ViewData["Name"]" />
                <span asp-validation-for="Name" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Hobby" class="control-label">简介</label>
                <textarea asp-for="Hobby" class="input_control"></textarea>
                <span asp-validation-for="Hobby" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="RealName" class="control-label">真实名字</label>
                <input asp-for="RealName" class="form-control" />
                <span asp-validation-for="RealName" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Phone" class="control-label">电话</label>
                <input asp-for="Phone" class="form-control" />
                <span asp-validation-for="Phone" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="StudentNumber" class="control-label">学号</label>
                <input asp-for="StudentNumber" class="form-control" />
                <span asp-validation-for="StudentNumber" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Sex" class="control-label">性别</label>
                <div class="custom-radio">
                    @{
                        if (Model.Sex == true)
                        {
                            <label class="checkbox-inline">
                                <input type="radio" name="Sex" id="Sex" value="true" checked> 男
                            </label>
                            <label class="checkbox-inline">
                                <input type="radio" name="Sex" id="Sex" value="false"> 女
                            </label>
                        }
                        else
                        {
                            <label class="checkbox-inline">
                                <input type="radio" name="Sex" id="Sex" value="true"> 男
                            </label>
                            <label class="checkbox-inline">
                                <input type="radio" name="Sex" id="Sex" value="false" checked> 女
                            </label>
                        }
                    }
                </div>
            </div>
            <div class="form-group">
                <input id="college" type="hidden" value="@ViewData["College"]" />
                <label asp-for="College" class="control-label">学院</label>
                <select name="College" id="select1" class="form-control" onchange="change()"></select>
            </div>
            <div class="form-group">

                <input id="major" type="hidden" value="@ViewData["ClassName"]" />
                <label asp-for="ClassName" class="control-label">专业</label>
                <select name="ClassName" id="select2" class="form-control"></select>
                <span asp-validation-for="StudentNumber" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Birthday">出生日期</label>
                <input type="text" id="txtName" class="date" value="@ViewData["date"]" name="Birthday" />
            </div>
            <div class="form-group">
                <input type="submit" value="保存" class="btn btn-primary" />
            </div>
        </form>
    </div>
</div>
@*</div>*@

@*<div>
        <a asp-action="Index"></a>
    </div>*@
@*</div>*@
@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

<script>
    var selector;
    //返回被选择radio的value属性值
    function whichRadioValueChecked(selector) {
        var rtn = "";
        selector.each(function () {
            if ($(this).prop("checked")) {
                rtn = $(this).attr("value");
            }
        });
        return rtn;
    }

    selector = $('input[type="radio"][name="radio1"]');
    var value = whichRadioValueChecked(selector);
</script>
<script>
    //市级数组
    var shi = document.getElementById("select1");
    var all_shi = ["电子信息工程学院", "机电学院", "汽车学院", "贸旅学院"];
    //将所有的直辖市在第一个列表中显示
    var flag = "";
    var a = $("#college").val();
    var b = $("#major").val();
    for (var i = 0; i < all_shi.length; i++) {
        if (a == i) {
            flag = flag + "<option value='" + i + "'selected>" + all_shi[i] + "</option>";
        } else {
            flag = flag + "<option value='" + i + "'>" + all_shi[i] + "</option>";
        }

    } shi.innerHTML = flag;
    //各区的数组（各区的数组的下标对应的是该市的数组的下标）
    var qu = document.getElementById("select2");
    var all_qu = [
        ["软件一班", "软件二班", "软件三班", "软件四班", "大数据一班", "大数据二班", "大数据三班", "大数据四班", "人工智能一班", "人工智能二班", "人工智能三班", "外包一班", "外包二班", "通信一班", "通信二班", "计算机技术一班", "计算机技术二班"],
        ["机械设计与制造一班", "机械设计与制造二班", "机械设计与制造三班", "机械设计与制造四班", "工业机器人技术一班", "工业机器人技术二班", "工业机器人技术三班", "工业机器人技术四班", "数控设备应用与维护一班", "数控设备应用与维护二班", "数控设备应用与维护三班", "数控设备应用与维护四班", "数控技术一班", "数控技术二班", "数控技术三班", "焊接技术与自动化一班", "焊接技术与自动化二班", "焊接技术与自动化三班"],
        ["汽车运用与维修技术一班", "汽车运用与维修技术二班", "汽车运用与维修技术三班", "汽车运用与维修技术四班", "汽车车身维修技术一班", "汽车车身维修技术二班", "汽车车身维修技术三班", "汽车营销与服务一班", "汽车营销与服务二班", "汽车营销与服务三班", "汽车营销与服务四班", "汽车电子技术一班", "汽车电子技术二班", "汽车电子技术三班", "汽车电子技术四班"],
        ["酒店管理一班", "酒店管理二班", "酒店管理三班", "酒店管理四班", "旅游管理一班", "旅游管理二班", "旅游管理三班", "旅游管理四班"],
    ];
    //将默认的北京市的所有区在第二个列表中显示
    console.log(b)
    flag = "";
    for (var j = 0; j < all_qu[a].length; j++) {
        if ([b] == all_qu[a][j]) {
            flag = flag + "<option selected>" + all_qu[a][j] + "</option>";
        }
        else {
            flag = flag + "<option >" + all_qu[a][j] + "</option>";
        }
    } qu.innerHTML = flag;
    //市级部分的回调函数
    function change() {
        //获取第一个列表对象
        flag = "";
        for (var j = 0; j < all_qu[shi.value].length; j++) {
            flag = flag + "<option>" + all_qu[shi.value][j] + "</option>";
        } qu.innerHTML = flag;
    }

</script>
<script src="~/js/jquery.js"></script>
<script src="~/js/jquery.jSelectDate.js"></script>
<script type="text/javascript">

    $("body").ready(function () {

        //应用方法
        $("input.date").jSelectDate({
            css: "date",
            yearBeign: 1995,
            disabled: false
        });

    })

    $(this).jSelectDate

</script>	